#!/bin/usr/python
#-*- encoding=UTF-8 -*-

"""
: Binary tree 
: 深度遍历，交换左右子节点
: 层次遍历，队列实现时，交换左右子节点
"""

# Definition for a binary tree node.
class TreeNode(object):
	def __init__(self, x):
		self.val = x
		self.left = None
		self.right = None


def invertTree(self, root):
	"""
	:type root: TreeNode
	:rtype: TreeNode
	"""
    if root is None:
        return
    else:
        tmp = root.left
        root.left = self.invertTree(root.right)
        root.right = self.invertTree(tmp)
        return root
